﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="UnityProperty.aspx.cs" Inherits="UnityProperty" %>

<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxTreeList.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxTreeList" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <script language="javascript" type="text/javascript">
        function show() {
            pupControl.Show();
        }
        function getAjax() {
            var dwbh = cdwbh.GetText();
            var dwmc = cdwmc.GetText();
            $.ajax({
                type: "POST",
                url: "Ashx/GetDwxz.ashx",
                data: { dwbh: dwbh, dwmc: dwmc },
                success: function (msg) {
                    if (dwbh == "") {
                        alert("请输入单位性质编码（两位数字）！");
                    }
                    else if (dwmc == "") {
                        alert("请输入单位性质名称！");
                    }
                    else {
                        if (msg == "sucess") {
                            alert("添加成功！");
                            if (pupControl.IsWindowVisible()) {
                                pupControl.Hide();
                            }
                        } else if (msg == "sorry") {
                            alert("对不起，您添加的内容已经存在！");
                        }
                        else if (msg == "two") {
                            alert("单位性质编码必须为两位数字！");
                        }
                    }
                }

            });
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="MainContent">
    <h1 class="DemoTitle">
        单位性质管理
    </h1>
    <div id="DemoArea">
        <h3>
            <a href="javascript:show()">添加顶级单位</a>
        </h3>
       
        <dx:ASPxTreeList ID="tvShow" runat="server" Width="600px" AutoGenerateColumns="False"
            ClientIDMode="AutoID" CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css"
            CssPostfix="Office2010Blue" ParentFieldName="sjbh" OnNodeDeleting="tvShow_NodeDeleting"
            OnNodeInserting="tvShow_NodeInserting" OnNodeUpdating="tvShow_NodeUpdating" KeyFieldName="xzbh">
            <Columns>
                <dx:TreeListTextColumn Caption="编号" VisibleIndex="0" Width="100px" 
                    FieldName="xzbh">
                    <PropertiesTextEdit NullText="请输入两位数字">
                    </PropertiesTextEdit>
                </dx:TreeListTextColumn>
                <dx:TreeListTextColumn Caption="名称" VisibleIndex="1" FieldName="xzmc">
                </dx:TreeListTextColumn>
                <dx:TreeListCommandColumn VisibleIndex="2" Width="200px">
                    <EditButton Text="编辑" Visible="True">
                    </EditButton>
                    <NewButton Text="新增" Visible="True">
                    </NewButton>
                    <DeleteButton Text="删除" Visible="True">
                    </DeleteButton>
                    <UpdateButton Text="更新">
                    </UpdateButton>
                    <CancelButton Text="取消">
                    </CancelButton>
                </dx:TreeListCommandColumn>
            </Columns>
            <Settings SuppressOuterGridLines="True" />
            <SettingsBehavior AllowFocusedNode="True" />
            <SettingsEditing Mode="EditFormAndDisplayNode" />
            <SettingsText CommandCancel="取消" CommandDelete="删除" CommandEdit="编辑" CommandNew="新增"
                CommandUpdate="更新" ConfirmDelete="确定要删除吗?" />
            <Images SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css">
                <LoadingPanel Url="~/App_Themes/Office2010Blue/TreeList/Loading.gif">
                </LoadingPanel>
            </Images>
            <Styles CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css" CssPostfix="Office2010Blue">
                <LoadingPanel ImageSpacing="5px">
                </LoadingPanel>
            </Styles>
            <StylesPager>
                <PageNumber ForeColor="#3E4846">
                </PageNumber>
                <Summary ForeColor="#1E395B">
                </Summary>
            </StylesPager>
            <StylesEditors ButtonEditCellSpacing="0">
            </StylesEditors>
        </dx:ASPxTreeList>
        <dx:ASPxPopupControl ID="pupControls" ClientInstanceName="pupControl" runat="server"
            Width="600px" ClientIDMode="AutoID" CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css"
            CssPostfix="Office2010Blue" EnableHotTrack="False" SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css"
            HeaderText="添加顶级单位" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
            <LoadingPanelImage Url="~/App_Themes/Office2010Blue/Web/Loading.gif">
            </LoadingPanelImage>
            <LoadingPanelStyle ImageSpacing="5px">
            </LoadingPanelStyle>
            <ContentCollection>
                <dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
                    <table width="100%">
                        <tr>
                            <td>
                                单位编号：
                            </td>
                            <td>
                                <dx:ASPxTextBox ID="txtdwbh" ClientInstanceName="cdwbh" runat="server" Width="170px"
                                    CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css" CssPostfix="Office2010Blue"
                                    SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css">
                                </dx:ASPxTextBox>
                            </td>
                            <td>
                                单位名称：
                            </td>
                            <td>
                                <dx:ASPxTextBox ID="txtdwmc" runat="server" ClientInstanceName="cdwmc" Width="170px"
                                    CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css" CssPostfix="Office2010Blue"
                                    SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css">
                                </dx:ASPxTextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" style="padding-left: 450px;">
                                <dx:ASPxButton ID="btnAdd" runat="server" AutoPostBack="false" Text="添加" CssFilePath="~/App_Themes/Office2010Blue/{0}/styles.css"
                                    CssPostfix="Office2010Blue" SpriteCssFilePath="~/App_Themes/Office2010Blue/{0}/sprite.css">
                                    <ClientSideEvents Click="function(s,e){getAjax();}" />
                                </dx:ASPxButton>
                            </td>
                        </tr>
                </dx:PopupControlContentControl>
            </ContentCollection>
        </dx:ASPxPopupControl>
    </div>
</asp:Content>
